home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / e / audiodt / test-audiodt.e < prev   
Text File  |  1999-06-14  |  1KB  |  54 lines

  1. /* Mini player, using datatypes.library and sound.datatype */
  2.  
  3. MODULE    'shark/audiodt',
  4.     'reqtools',
  5.     'libraries/reqtools',
  6.  
  7.     'datatypes/pictureclass'    -> bmhd
  8.  
  9. PROC main()
  10. DEF file,audio:PTR TO audiodt
  11.  
  12. file:=filereq('Please choose file');
  13.  
  14. NEW audio
  15.  
  16. IF audio.load(file)=0 ; END audio ; CleanUp(0) ; ENDIF
  17.  
  18. WriteF('SAMPLE POSITION IN MEMORY: $\h\nSAMPLE LENGTH: \d\n',audio.buf,audio.buflen);
  19.  
  20. audio.setvolume(64);
  21. audio.setperiod(330);
  22. audio.setcycles(1);
  23.  
  24. audio.play()
  25.  
  26. WriteF('Ctrl+C to quit...');
  27.  
  28. REPEAT ; Delay(10); UNTIL CtrlC()
  29.  
  30. WriteF('\n')
  31. audio.dispose()
  32.  
  33. END audio
  34.  
  35. ENDPROC
  36.  
  37.  
  38.  
  39. /********** File Requester (REQTOOLS) ********/
  40. PROC filereq(title)
  41. DEF dir[4096]:STRING,buf[512]:STRING,req:PTR TO rtfilerequester
  42. IF reqtoolsbase:=OpenLibrary('reqtools.library',37)
  43.     IF req:=RtAllocRequestA(0,0)
  44.             RtFileRequestA(req,buf,title,0)
  45.             RtFreeRequest(req)
  46.     ENDIF
  47. CloseLibrary(reqtoolsbase)
  48. IF StrCmp(req.dir,'')=0 THEN StringF(dir,'\s/\s',req.dir,buf) ELSE StrCopy(dir,buf);
  49. RETURN dir
  50. ELSE
  51. WriteF('Cannot open reqtools.library V37\n')
  52. ENDIF
  53. ENDPROC
  54.